package com.frxuexi.sign.viewmodel

import com.frxuexi.lib_base.ApiResponse
import com.frxuexi.lib_base.BaseViewModel
import com.frxuexi.lib_base.UiState
import com.frxuexi.sign.intent.SignIntent
import com.frxuexi.sign.repository.SignRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

@HiltViewModel
class SignViewModel @Inject constructor(private val signRepository: SignRepository) :BaseViewModel<SignIntent,UiState<Any>>() {
    override fun handlerIntent(intent: SignIntent) {
        when(intent){
            is SignIntent.getSignList->{
                httpRequest(signRepository.getSignList(intent.map) as Flow<ApiResponse<Any>>)
            }
            is SignIntent.sign->{
                httpRequest(signRepository.sign(intent.map) as Flow<ApiResponse<Any>>)
            }
            else->{}
        }
    }
}